#!/bin/bash

outf="../prefix.23724"
if [ -e $outf ]; then rm -f $outf; fi

for f in /media/DATA/workspace/flatten/data/ROUTE_USETIME/201004/*; do
	mon=${f##*/}; ip=${mon%.*}; as=${mon##*.};
	awk -F"|" -v AS=$as -v IP=$ip '{
		if ($2 == 23724 && $3 < 86400) {
			printf "%s %s %s %s", $1, AS, IP, $4;
			for (i = 5; i < NF; i += 2) printf " %s %s", $i, $(i+1);
			printf "\n";
		}
	}' $f >> $outf
done

